#include <iostream>
#include <array>
#include <algorithm>
#include <string>
#include "fmt/format.h"
using namespace std;

int main() {
    std::array colors{ "red"s, "orange"s,"yellow"s,"green"s,"blue"s,"gray"s };

    cout << "unsorted:\n";
    for (const string& it : colors) {
        cout << fmt::format("{} ", it);
    }
    cout << "\n";
    std::sort(colors.begin(), colors.end());

    cout << "after sorted:\n";
    for (const string& it : colors) {
        cout << fmt::format("{} ", it);
    }
    cout << "\n";

    {
        bool found{ std::binary_search(colors.begin(),colors.end(),"indigo") };
        cout << fmt::format("indigo {} found in colors array\n", found ? "was"s : "was not"s);
    }

    {
        bool found{ std::binary_search(colors.begin(),colors.end(),"green") };
        cout << fmt::format("green {} found in colors array\n", found ? "was"s : "was not"s);
    }
    return 0;
}